<?
//yunUploadSt = 0 没有上传
//yunUploadSt = 2 上传中
//yunUploadSt = 1 上传完毕
$bucket = 'app4ios';
header("Content-type: text/html; charset=utf-8");
 
require '../sdk.class.php';
$uploadMinSize = 100000000; //100m;
 
$r['path'] = $_POST['path'];

if($r['path']) //上传
{
	//echo basename($r['path']);
	/**
	 * 加载sdk包以及错误代码包
	 */
	$oss_sdk_service = new ALIOSS();
	
	//设置是否打开curl调试模式
	$oss_sdk_service->set_debug_mode(TRUE);
	try{
		
		$fname = basename($r['path']);
		upload_by_multi_part($oss_sdk_service,$fname,$r['path']);
	 	
	}catch (Exception $ex){
	    
		die($ex->getMessage());
	}
	echo '{"st":"ok","msg":"ok"}';
}
else
{
	echo '{"st":"err","msg":"no file"}';
}
//通过multipart上传文件
function upload_by_multi_part($obj,$objName,$filePath){
	global $bucket;
	$object = $objName;  //英文
	$filepath = $filePath;  //英文
	$options = array(
		ALIOSS::OSS_FILE_UPLOAD => $filepath,
		'partSize' => 5242880,
	);
	$response = $obj->create_mpu_object($bucket, $object,$options);
}
?>